home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / dev / disk.h < prev    next >
Text File  |  1995-02-14  |  4KB  |  133 lines

  1. /*    @(#)disk.h    1.0    08/29/87    (c) 1987 NeXT    */
  2.  
  3. /* 
  4.  * HISTORY
  5.  * 28-Mar-92  Doug Mitchell
  6.  *      Moved disk_label struct to <bsd/dev/disk_label.h>.
  7.  *
  8.  * 22-May-91  Gregg Kellogg (gk) at NeXT
  9.  *    Split out public interface.
  10.  *
  11.  * 20-Jul-90  Doug Mitchell
  12.  *    Added DKIOCSFORMAT, DKIOCGFORMAT
  13.  *
  14.  * 16-Apr-90  Doug Mitchell at NeXT
  15.  *    Added DKIOCPANELPRT.
  16.  *
  17.  * 25-Mar-90  John Seamons (jks) at NeXT
  18.  *    Removed obsolete DKIOCNOTIFY and DKIOCINSERT.
  19.  *
  20.  * 23-Mar-90  Doug Mitchell
  21.  *    Added DKIOCEJECT.
  22.  * 
  23.  * 14-Feb-90  Doug Mitchell at NeXT
  24.  *    Added DKIOCMNOTIFY.
  25.  *
  26.  * 16-Mar-88  John Seamons (jks) at NeXT
  27.  *    Cleaned up to support standard disk label definitions.
  28.  *
  29.  * 24-Feb-88  Mike DeMoney (mike) at NeXT
  30.  *    Added defines for dl_bootfile and dl_boot0_blkno.
  31.  *    Reduced NBAD to allow for these entries in disktab.
  32.  *
  33.  * 29-Aug-87  John Seamons (jks) at NeXT
  34.  *    Created.
  35.  *
  36.  */
  37.  
  38. #ifndef    _BSD_DEV_DISK_
  39. #define    _BSD_DEV_DISK_
  40.  
  41. #import    <mach/machine/vm_types.h>
  42. #import    <mach/machine/boolean.h>
  43. #import <sys/types.h>
  44. #import <sys/ioctl.h>
  45. #import <sys/time.h>
  46. #import <bsd/dev/disk_label.h>
  47.  
  48. #define    DR_CMDSIZE    32
  49. #define    DR_ERRSIZE    32
  50.  
  51. struct disk_req {
  52.     int    dr_bcount;        /* byte count for data transfers */
  53.     caddr_t    dr_addr;        /* memory addr for data transfers */
  54.     struct    timeval dr_exec_time;    /* execution time of operation */
  55.  
  56.     /* 
  57.      * interpretation of cmdblk and errblk is driver specific.
  58.      */
  59.     char    dr_cmdblk[DR_CMDSIZE];
  60.     char    dr_errblk[DR_ERRSIZE];
  61. };
  62.  
  63. struct sdc_wire {
  64.     vm_offset_t    start, end;
  65.     boolean_t    new_pageable;
  66. };
  67.  
  68.  
  69. #define    BAD_BLK_OFF    4        /* offset of bad blk tbl from label */
  70. #define    NBAD_BLK    (12 * 1024 / sizeof (int))
  71.  
  72. struct bad_block {            /* bad block table, sized to be 12KB */
  73.     int    bad_blk[NBAD_BLK];
  74. };
  75.  
  76. /* 
  77.  * sector bitmap states (2 bits per sector) 
  78.  */
  79. #define    SB_UNTESTED    0        /* must be zero */
  80. #define    SB_BAD        1
  81. #define    SB_WRITTEN    2
  82. #define    SB_ERASED    3
  83.  
  84. struct drive_info {            /* info about drive hardware */
  85.     char    di_name[MAXDNMLEN];    /* drive type name */
  86.     int    di_label_blkno[NLABELS];/* label loc'ns in DEVICE SECTORS */
  87.     int    di_devblklen;        /* device sector size */
  88.     int    di_maxbcount;        /* max bytes per transfer request */
  89. };
  90.  
  91. #define    DS_STATSIZE    32
  92.  
  93. struct    disk_stats {
  94.     int    s_ecccnt;    /* avg ECC corrections per sector */
  95.     int    s_maxecc;    /* max ECC corrections observed */
  96.  
  97.     /* 
  98.      * interpretation of s_stats is driver specific 
  99.      */
  100.     char    s_stats[DS_STATSIZE];
  101. };
  102.  
  103. #define    DKIOCGLABEL    _IO('d', 0)            // read label
  104. #define    DKIOCSLABEL    _IO('d', 1)            // write label
  105. #define    DKIOCGBITMAP    _IO('d', 2)            // read bitmap
  106. #define    DKIOCSBITMAP    _IO('d', 3)            // write bitmap
  107. #define    DKIOCREQ    _IOWR('d', 4, struct disk_req)    // cmd request
  108. #define    DKIOCINFO    _IOR('d', 5, struct drive_info)    // get drive info
  109. #define    DKIOCZSTATS    _IO('d',7)            // zero statistics
  110. #define    DKIOCGSTATS    _IO('d', 8)            // get statistics
  111. #define    DKIOCRESET    _IO('d', 9)            // reset disk
  112. #define    DKIOCGFLAGS    _IOR('d', 11, int)        // get driver flags
  113. #define    DKIOCSFLAGS    _IOW('d', 12, int)        // set driver flags
  114. #define    DKIOCSDCWIRE    _IOW('d', 14, struct sdc_wire)    // sdc wire memory
  115. #define    DKIOCSDCLOCK    _IO('d', 15)            // sdc lock
  116. #define    DKIOCSDCUNLOCK    _IO('d', 16)            // sdc unlock
  117. #define    DKIOCGFREEVOL    _IOR('d', 17, int)        // get free volume #
  118. #define    DKIOCGBBT    _IO('d', 18)            // read bad blk tbl
  119. #define    DKIOCSBBT    _IO('d', 19)            // write bad blk tbl
  120. #define    DKIOCMNOTIFY    _IOW('d', 20, int)        // message on insert
  121. #define    DKIOCEJECT    _IO('d', 21)            // eject disk
  122. #define    DKIOCPANELPRT    _IOW('d', 22, int)        // register Panel
  123.                             // Request port
  124. #define DKIOCSFORMAT    _IOW('d', 23, int)        // set 'Formatted' flag 
  125. #define DKIOCGFORMAT    _IOR('d', 23, int)        // get 'Formatted' flag 
  126. #define DKIOCBLKSIZE    _IOR('d', 24, int)        // device sector size
  127. #define    DKIOCNUMBLKS    _IOR('d', 25, int)        // number of sectors
  128. #define DKIOCCHECKINSERT _IO('d',26)        // manually poll removable 
  129.                         // media drive
  130. #define DKIOCCANCELAUTOMOUNT _IOW('d',27, dev_t)    // cancel automount request
  131. #endif    _BSD_DEV_DISK_
  132.  
  133.